package com.glasses.manage.core.exception;

/**
 * @描述: 数据操作异常
 * @作者 Mr.yy
 * @创建时间 2017/6/15
 * @版本: 1.0
 */
public class DataAccessException extends ApiRuntimeException {
    /**
     * 异常信息
     */
    protected String msg;
    /**
     * 具体异常码
     */
    protected int code;

    public String getMsg() {
        return msg;
    }

    public int getCode() {
        return code;
    }


    public DataAccessException() {
        super();
    }

    public DataAccessException(DataAccessExceptionType type) {
        this.code = type.getCode();
        this.msg = type.getMsg();
    }

    public DataAccessException(int code, String msgFormat, Object... args) {
        super(String.format(msgFormat, args));
        this.code = code;
        this.msg = String.format(msgFormat, args);
    }

    public DataAccessException(String message) {
        super(message);
    }

    public DataAccessException(String message, Throwable cause) {
        super(message, cause);
    }

    public DataAccessException(Throwable cause) {
        super(cause);
    }
}
